﻿Public Class clsTaskStep
    Public Function SelectTaskStep() As DataTable
        Dim szSql As String = ""
        szSql &= "select agv.task_step.* from agv.task left join agv.task_step on agv.task.sys_id=agv.task_step.task_id 
where agv.task.tm=1 and agv.task_step.previous_id is not null "
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1)
        If IsNothing(dt) Then
            SelectTaskStep = New DataTable
        Else
            SelectTaskStep = dt
        End If
    End Function

    Public Function SelectTaskTM() As DataTable
        Dim szSql As String = ""
        szSql &= "select a.*,b.prod_spec_id from agv.task_tm a "
        szSql &= " left join sf.b_prod_info b on a.prod_id=b.prod_id"
        szSql &= " where a.status <> ? "
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "任务完成启动")
        Return dt
    End Function

    Public Function SelectTaskStepRecord(id As String) As DataTable
        Dim szSql As String = ""
        szSql &= "select * from agv.task_step_record where sys_id = ? "
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, id)
        If IsNothing(dt) Then
            SelectTaskStepRecord = New DataTable
        Else
            SelectTaskStepRecord = dt
        End If
    End Function

    Public Function SelectTmj(task_step_id As String) As DataTable
        Dim szSql As String = ""
        szSql &= "select * from agv.tmj where task_step_id = ? and agv_start1 = 1 and tmj_stop_write is null"
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, task_step_id)
        If IsNothing(dt) Then
            SelectTmj = New DataTable
        Else
            SelectTmj = dt
        End If
    End Function


End Class
